#!/usr/bin/env python
# -*- coding: UTF-8 -*-

class Person:
    def __init__(self, id, name, sex, age):
        self._id = id
        self._name = name
        self._sex = sex
        self._age = age

    def __eq__(self, other):
        return self._id == other._id

    def __hash__(self):
        return hash(id)



if __name__ == "__main__":
    xm = Person("123", "xiaoming", 1, 18)
    xm1 = Person("123", "Wang Xiaoming", 1, 20)
    if xm == xm1:
        print("xm and xm1 is the same person")

    persons = set()
    persons.add(xm)
    persons.add(xm1)

    print("There are {} persions".format(len(persons)))
    for p in persons:
        print("id = {}, name = {}, age = {}".format(p._id, p._name, p._age))
